package hc.bre.deci.action

import hc.bre.ComponentRegistry
import hc.bre.cmn.RuleDefinition
import hc.bre.cmn.struct.DataStructItem
import hc.bre.data.strategy.StrategyDefinition
import hc.bre.data.strategy.StrategyStruct

@groovy.transform.CompileStatic
class StrategySetter extends ActionBuilder{
	@Override
	public String getActionResult() {
		def className =  builder.referRuleClass(this.act.refer  as String);
		StrategyDefinition ruleDef = builder.rule(this.act.refer as String) as StrategyDefinition;
		def code =ruleDef.find(this.input as Integer).code;
		return className + '.' + code;
	}

	@Override
	public DataStructItem getResultStructItem() {
		StrategyDefinition ruleDef = builder.rule(this.act.refer as String) as StrategyDefinition;
		return new StrategyStruct().fillUserDef(ruleDef).root;
	}
}
